package cn.wizzer.app.user.modules.models;


import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Table("user_gift_order")
@TableIndexes({@Index(name = "INDEX_CT_AT", fields = {"ctAt"}, unique = false)})
public class UserGiftOrder extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column("from_user")
    @Comment("送礼人")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String fromUser;

    @Column("to_user")
    @Comment("收礼人")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String toUser;

    @Column("gift_id")
    @Comment("礼物ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String giftId;

    @Column
    @Comment("总额")
    @ColDefine(type=ColType.FLOAT, width=16, precision=6)
    private BigDecimal amount;


    @Column
    @Default("1")
    @Comment("数量")
    @ColDefine(type=ColType.INT, width=4)
    private Integer count;

    @Column("sum_to_balance")
    @Default("0")
    @Comment("已结算?1:0")
    @ColDefine(type = ColType.BOOLEAN)
    private boolean sumToBalance;

    @Column("live_id")
    @Comment("直播ID(live_broadcast)")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String liveId;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    //Long不要用ColDefine定义,兼容oracle/mysql,支持2038年以后的时间戳
    private Long ctAt;



}
